#pragma once

#include <vector>
#include "config.h"
using namespace std;

class Calls{
public:
	/** Constructor
	 * Creates an empty Calls table
	 */
	Calls();

	/**
	 * Add a Calls relationship of first procedure calling second procedure.
	 * @param procIndex1 the index of first procedure.
	 * @param procIndex2 the index of second procedure.
	 * @return the index of newly added Calls relationship, -1 if unsuccessful.
	 */
	int addCalls(int procIndex1, int procIndex2);

	/**
	 * Get a list of all matching pairs that directly calls each other.
	 * @param procIndex1 index of first procedure, can be const ANYVALUE.
	 * @param procIndex2 index of second procedure, can be const ANYVALUE.
	 * @return a vector of pairs that satisfies the criteria, empty if does not exist.
	 */
	vector<pair<int, int>> getCalls(int procIndex1, int procIndex2);

	/**
	 * Get a list of all matching pairs that directly or undirectly calls each other.
	 * @param procIndex1 index of first procedure, can be const ANYVALUE.
	 * @param procIndex2 index of second procedure, can be const ANYVALUE.
	 * @return a vector of pairs that satisfies the criteria, empty if does not exist.
	 */
	vector<pair<int, int>> getCallsStar(int procIndex1, int procIndex2);

private:
	vector<pair<int, int>> callsIndex; /**< A Calls table that contains all pairs of procedure calls */
};
